﻿using System;

namespace ELW.Library.Math.Calculators.Standard
{
    class CalculatorNOT : IOperationCalculator
    {
        #region IOperationCalculator Members

        public double Calculate(params double[] parameters)
        {
            if (parameters == null)
                throw new ArgumentNullException("parameters");
            if (parameters.Length != 1)
                throw new ArgumentException("It is unary operation. Parameters count should be equal to 1.", "parameters");
            if (parameters[0] != 1 && parameters[0] != 0)
                throw new ArgumentException("It isn't bool value1.", "parameters");
            if (parameters[0] == 1)
                return 0.0;
            else
                return 1.0;
        }

        #endregion
    }
}
